<?
include "config.php";?>
 <?include "header.php";?>
 <?include "admin_auth.php";?>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

<link href="style.css" rel="stylesheet" type="text/css">
<table width="770" border="0" cellspacing="1" cellpadding="0" bgcolor="#000000" align="center">
  <tr>
    <td bgcolor="#FFFFFF">
      <div align="right" class="text"><font color="#FF0000"><a href="admin_query.php">����Ա��ѯ</a>��<a href="add_book.php">���ͼ��</a></font></div>
    </td>
  </tr>
</table>
<table width="770" border="0" cellspacing="1" cellpadding="0" bgcolor="#333333" align="center">
  <tr> 
    <td bgcolor="#FFFFFF"> 
      <div align="center" class="title">����</div>
    </td>
    <td width=100 bgcolor="#FFFFFF"> 
      <div align="center" class="title">����</div>
    </td>
    <td bgcolor="#FFFFFF"> 
      <div align="center" class="text"> 
        <p>������</p>
      </div>
    </td>
    <td width=65 bgcolor="#FFFFFF"> 
      <div align="center" class="title">��������</div>
    </td>
    <td width="5%" bgcolor="#FFFFFF"> 
      <div align="center" class="title">�۸�(Ԫ)</div>
    </td>
    <td width="9%" bgcolor="#FFFFFF"> 
      <div align="center" class="title">�����</div>
    </td>
    <td width=30 bgcolor="#FFFFFF" class="title"> 
      <div align="center">����</div>
    </td>
    <td width=30 bgcolor="#FFFFFF" class="title">
      <div align="center">״̬</div>
    </td>
    <td width="9%" bgcolor="#FFFFFF" class="title">
      <div align="center">ɾ��</div>
    </td>
  </tr>
  <? 
  $n=0; 
  $query=mysql_query("select count(*) as sm from book_list  ");
   $row=mysql_fetch_array($query);
   $count=$row[sm];
    if(empty($offset))
              {$offset=0;}
			 
   $query=mysql_query("select * from book_list order by book_id desc limit $offset,$list_num") or die ("fail");
   while($row=mysql_fetch_array($query)){
        if(($n%2)!='0'){
 	  echo "<tr bgcolor=#FFFFff>";}
	  else{
	  echo "<tr bgcolor=#E4E4E4>";
	  }
     echo"<td   height='15'> 
		<div align='center' class='text'>".$row['book_name']."</div></td>
    <td width=100  height='15' class='text'> <div align='center'>".$row['author']."</div></td>
    <td   height='15' class='text'> <div align='center'>".$row['pub_addr']."</div></td>
    <td width=65  height='15' class='text'> <div align='center'>".$row['pub_date']."</div></td>
    <td width='5%'  height='15' class='text'><div align='center'>".$row['price']."</div></td>
    <td width='9%'  height='15' class='text'> <div align='center'>".$row['sort_id']."</div></td>
    <td  height='15' class='text'> <div align='center'>".$row['volumes']."</div></td>
    <td width=30  height='15' class='text'>
			<div align='center'>".$row['status']."</div></td>
    <td   height='15' class='text'><div align='center'>
		<a href=book_del.php?book_id=".$row['book_id'].">ɾ��</a></div></td>
  </tr> ";
   $n++;
   }
 ?></table><?
    $pages=ceil($count/$list_num);
echo "<table width=770 border=0 cellspacing=0 cellpadding=0 align=center class='text'>
          <tbody> 
          <tr> 
     <td width='159'><font color='#ff0000'>Ŀǰ���У�".$count." ����¼</font> </td>
    <td width='205'>".$pages."ҳ</td>";

	  if($offset){
		$preoffset=$offset-$list_num;
	print "<td width='132'><a href=\"$PHP_SELF?offset=$preoffset\">��һҳ</a></td>";}
	else {
	  echo "<td width='132'>��һҳ</td>";
	}
	 $newoffset=$offset+$list_num;
	  if(($pages!=0)&&(($newoffset/$list_num)!=$pages))
	{
	 print("<td width='158'><a  href=\"$PHP_SELF?offset=$newoffset\">��һҳ</a></td>");
	}
	 else{ echo "<td width='158'>��һҳ</td>";}
	$pageno=($offset/$list_num)+1;
	echo "<td width='112' class=text>��<input class=text type='text' size='4'value=".$pageno." readonly>
      ҳ</td>
    <td width='4'>&nbsp;</td></tr>
</table>";
   ?>
<?include "foot.php";?>
